package com.zsj.juc.jmm;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;

/**
 * @author zsj
 * @version 1.0
 * @date 2024/5/7 10:30
 * @description
 */
public class ThreadNameTest {
    //输出一个helloworld 有多少个线程呢？
    public static void main(String[] args) {
        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
        ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(false, false);
        for (ThreadInfo threadInfo : threadInfos) {
            System.out.println(threadInfo.getThreadName());
        }
        System.out.println("hello world");
    }

}
